myPromise.prototype.all = function (fns) {
    return new myPromise((resolve, reject) => {
        let result = [];
        for (let i = 0; i < fns.length; i++) {
            fn[i].then(function (res) {
                result[i] = res;
                if (result.length === fns.length) {
                    resolve(result)
                }
            }, function (err) {
                reject(err)
            })
        }

    })
};


myPromise.prototype.race = function (fns) {
    return new myPromise((resolve, reject) => {
        for (let i = 0; i < fns.length; i++) {
            fn[i].then(function (res) {
                resolve(res)
            }, function (err) {
                reject(err)
            })
        }
    })
}